- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
test: fix false positive in Microvm.kill check for correct pid #5232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    "No more than 12 if statements in a function" does not a good lint make. Signed-off-by: Patrick Roy <[email protected]>
Clean up the error messages we print when running into the "firecracker pid was killed, but process with its jailer id still exists" case: Also print the PID of the offending process, as well as filter out non-firecracker processes from the error message (otherwise the error message always contained the grep process itself, which was confusing). Note that `cmd` must be the last column, as otherwise ps will truncate it. Signed-off-by: Patrick Roy <[email protected]>
In Microvm.kill() we have a sanity check for ensuring the firecracker process wrote the correct pid to its pidfile: We ps | grep for the jailer id of the supposedly dead firecracker process and see if any process that has "fircracker" somewhere in its argv is using it (with the somewhat reasonable assumption that this would be exactly the firecracker process we just tried to kill). Howver, if the firecracker process isnt daemonized, then we spawn it under `screen`, and now we have two processes that contain both the jailer id and the name "firecracker" in its argv, because screen fork()s into firecracker in this case. Now if we kill firecracker, screen might stick around a bit longer (because we only explicitly wait for firecracker to terminate), and the sanity check might incorrectly pick up the screen process as a firecracker process and cause a spurious test failure. Fix this by having the check explicitly ignore all screen processes. Signed-off-by: Patrick Roy <[email protected]>
| Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@            Coverage Diff             @@
##             main    #5232      +/-   ##
==========================================
+ Coverage   82.89%   82.94%   +0.05%     
==========================================
  Files         250      250              
  Lines       26965    26965              
==========================================
+ Hits        22353    22367      +14     
+ Misses       4612     4598      -14     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
              
                    bchalios
  
              
              reviewed
              
                  
                    May 29, 2025 
                  
              
              
            
            
Split an assertion on a conjunction into multiple assertions, to make it easier to see which of the individual checks failed. Suggested-by: Babis Chalios <[email protected]> Signed-off-by: Patrick Roy <[email protected]>
              
                    bchalios
  
              
              approved these changes
              
                  
                    May 29, 2025 
                  
              
              
            
            
              
                    ShadowCurse
  
              
              approved these changes
              
                  
                    May 29, 2025 
                  
              
              
            
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Changes
In Microvm.kill() we have a sanity check for ensuring the firecracker
process wrote the correct pid to its pidfile: We ps | grep for the
jailer id of the supposedly dead firecracker process and see if any
process that has "fircracker" somewhere in its argv is using it (with
the somewhat reasonable assumption that this would be exactly the
firecracker process we just tried to kill). Howver, if the firecracker
process isnt daemonized, then we spawn it under
screen, and now wehave two processes that contain both the jailer id and the name
"firecracker" in its argv, because screen fork()s into firecracker in
this case. Now if we kill firecracker, screen might stick around a bit
longer (because we only explicitly wait for firecracker to terminate),
and the sanity check might incorrectly pick up the screen process as a
firecracker process and cause a spurious test failure.
Fix this by having the check explicitly ignore all screen processes.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkstyleto verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.